package com.ian.offer;

import com.ian.linked.ListNode;

import java.util.List;

/**
 * @author zhangyaowen
 * @date 2021/2/21 4:34 下午
 */
public class ReverseList {



    public ListNode reverseList(ListNode head) {

        ListNode pre  = null;
        ListNode curr = head;

        while(curr!=null){
            ListNode next = curr.next;
            curr.next = pre;
            pre = curr;
            curr = next;

        }

        return  pre;


    }
}
